package com.toune.movie.service;

import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.toune.movie.base.App;

/**
 * 监听服务是否被杀死
 */
public class MyBroadcastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
//        if (intent.getAction().equals(Intent.ACTION_TIME_TICK)) {
////检查Service状态
//            boolean isServiceRunning = false;
//            ActivityManager manager = (ActivityManager) App.getInstance().getSystemService(Context.ACTIVITY_SERVICE);
//            for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
//                if ("com.toune.movie.service.LocalFileService".equals(service.service.getClassName()))
//                //Service的类名
//                {
//                    isServiceRunning = true;
//                }
//
//            }
//            if (!isServiceRunning) {
//                Intent i = new Intent(context, LocalFileService.class);
//                context.startService(i);
//            }
//        }
    }
}
